//
//  L2Dictionary.m
//  Lesson2
//
//  Created by Alexander Trifonov on 20.04.12.
//  Copyright (c) 2012 fgengine@gmail.com. All rights reserved.
//

#import "L2Dictionary.h"

@implementation L2Dictionary

- (void) execute
{
    NSDictionary *d1 = [NSDictionary dictionary];
    NSDictionary *d2 = [NSDictionary dictionaryWithObject:@"Bill" forKey:@"name"];
    NSDictionary *d3 = [NSDictionary dictionaryWithDictionary:d2];
    
    NSLog(@"-L2Dictionary---------------------------");
    
    NSArray *theObjects = [NSArray arrayWithObjects:@"Bill", [NSNumber numberWithInt:32], nil];
    NSArray *theKeys = [NSArray arrayWithObjects:@"name", @"age", nil];
    NSDictionary *d4 = [NSDictionary dictionaryWithObjects:theObjects forKeys:theKeys];
    NSLog(@"%@", d4);
    
    NSLog(@"----------------------------------------");
    
    NSDictionary *d5 = [NSDictionary dictionaryWithObjectsAndKeys:
                        @"Bill", @"name",
                        [NSNumber numberWithInt:32], @"age", 
                        nil];
    NSLog(@"%@", d5);
    
    NSLog(@"----------------------------------------");
    
    NSInteger count = [d5 count];
    NSLog(@"%i", count);
    
    NSLog(@"----------------------------------------");
    
    BOOL equal = [d5 isEqualToDictionary:d4];
    NSLog(@"Equal? %i", equal);
    
    NSLog(@"----------------------------------------");
    
    NSArray *keys = [d4 allKeys];
    NSLog(@"Keys: %@", keys);
    
    NSLog(@"----------------------------------------");
    
    NSArray *values = [d5 allValues];
    NSLog(@"Values: %@", values);
    
    NSLog(@"----------------------------------------");
    
    id obj = [d5 objectForKey:@"name"];
    NSLog(@"Value for name is %@", obj);
    
    NSLog(@"----------------------------------------");
}

@end
